﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MvcEngine.Blog.Models.Entities;
using MvcEngine.Core.Content;
using MvcEngine.Core.Helpers;

namespace MvcEngine.Blog.Components.Extensions
{
    public static class BlogExtensions
    {
        public static string Page(this BlogData blog)
        {
            var page = ContentManager.Current.GetPage(blog.PageId);
            Guard.ThrowIfNull(blog, string.Format("Blog '{0}' has wrong configuration. Page '{1}' does not exist.", blog.Name, blog.Id));
            return page.Name;
        }
    }
}
